<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>创建虚拟 DOM 对象 - 原生 JS</title>
</head>
<body>
    <div id="root"></div>

    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>

    <!-- 这里不需要写 text/babel -->
    <script> 
        //1. 创建虚拟DOM对象  <h1 id="abc">Hello</h1>   
        // let vDOM = React.createElement(标签名, 属性, 子元素);
        //单层结构
        // let vDOM = React.createElement('h1', {id: 'abc'}, 'Hello');
        //多层结构
        let vDOM = React.createElement(
                'div', 
                null,
                React.createElement('h2', {title: 'abc'}, '最折磨人的或许不是一场惨烈战争，而是烦琐的日常生活。'),
                React.createElement('p', {id: 'author'}, '亦舒xx')
        );

        //2. 将虚拟DOM插入到容器中
        ReactDOM.render(vDOM, document.querySelector("#root"));
    </script>
</body>
</html>